package org.example.scenicspot.service;

import org.example.scenicspot.domain.EmergencyRescuePerson;
import org.example.scenicspot.domain.EmergencyRescueVehicle;
import org.example.scenicspot.domain.Staff;
import org.example.scenicspot.persistence.emergencyRescueVehicleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class emergencyRescueVehicleService {
    @Autowired
    emergencyRescueVehicleMapper emergencyRescueVehicleMapper;

    public List<EmergencyRescueVehicle> showemergencyRescueVehicle(){
        return emergencyRescueVehicleMapper.selectAll();
    }

    public  List<EmergencyRescueVehicle> selectByScenicAreaID(int scenicAreaID){
        return emergencyRescueVehicleMapper.selectByScenicAreaID(scenicAreaID);
    }

    public  List<EmergencyRescueVehicle> searchemergencyRescueVehicle(String keyword){
        return emergencyRescueVehicleMapper.selectByLicensePlateNumber(keyword);
    }

    public  void deleteemergencyRescueVehicle(int id){
        emergencyRescueVehicleMapper.deleteById(id);
    }

    public  void insertemergencyRescueVehicle(EmergencyRescueVehicle emergencyRescueVehicle){
        emergencyRescueVehicleMapper.insert(emergencyRescueVehicle.getId(),emergencyRescueVehicle.getLicensePlateNumber(),emergencyRescueVehicle.getVehicleType(),emergencyRescueVehicle.getCapacity(),emergencyRescueVehicle.getStatus(),emergencyRescueVehicle.getScenicAreaID());
    }

    public  void updateemergencyRescueVehicle(EmergencyRescueVehicle emergencyRescueVehicle){
        emergencyRescueVehicleMapper.update(emergencyRescueVehicle.getId(),emergencyRescueVehicle.getLicensePlateNumber(),emergencyRescueVehicle.getVehicleType(),emergencyRescueVehicle.getCapacity(),emergencyRescueVehicle.getStatus(),emergencyRescueVehicle.getScenicAreaID());
    }
}
